<?xml version="1.0" encoding="UTF-8"?>
<as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema"
	xmlns:ogc="http://www.opengis.net/ogc" xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.geotools.org/app-schema AppSchemaDataAccess.xsd
                      http://www.opengis.net/ogc http://schemas.opengis.net/filter/1.1.0/expr.xsd">
	<namespaces>
		<Namespace>
			<prefix>gsml</prefix>
			<uri>http://xmlns.geosciml.org/GeoSciML-Core/3.2</uri>
		</Namespace>
		<Namespace>
			<prefix>gml</prefix>
			<uri>http://www.opengis.net/gml/3.2</uri>
		</Namespace>
		<Namespace>
			<prefix>xlink</prefix>
			<uri>http://www.w3.org/1999/xlink</uri>
		</Namespace>
		<Namespace>
			<prefix>sa</prefix>
			<uri>http://www.opengis.net/sampling/2.0</uri>
		</Namespace>
		<Namespace>
		    <prefix>sams</prefix>
		    <uri>http://www.opengis.net/samplingSpatial/2.0</uri>
		</Namespace>
		<Namespace>
			<prefix>spec</prefix>
			<uri>http://www.opengis.net/samplingSpecimen/2.0</uri>
		</Namespace>
		<Namespace>
			<prefix>gsmlbh</prefix>
			<uri>http://xmlns.geosciml.org/Borehole/3.2</uri>
		</Namespace>
		<Namespace>
		    <prefix>xsi</prefix>
		    <uri>http://www.w3.org/2001/XMLSchema-instance</uri>
		</Namespace>
	</namespaces>
	<sourceDataStores>
		<DataStore>
			<id>Borehole</id>
			<parameters>
				<Parameter>
					<name>directory</name>
					<value>file:./</value>
				</Parameter>
			</parameters>
		</DataStore>
	</sourceDataStores>
	<targetTypes>
		<FeatureType>
		    <schemaUri>http://schemas.opengis.net/samplingSpecimen/2.0/specimen.xsd</schemaUri>
			<schemaUri>http://schemas.geosciml.org/borehole/3.2/borehole.xsd</schemaUri>
		</FeatureType>
	</targetTypes>
	<typeMappings>
		<FeatureTypeMapping>
			<sourceDataStore>Borehole</sourceDataStore>
			<sourceType>Gsml32Borehole</sourceType>
			<targetElement>gsmlbh:Borehole</targetElement>
			<attributeMappings>
				<AttributeMapping>
					<targetAttribute>gsmlbh:Borehole</targetAttribute>					
					<idExpression>
                        <OCQL>BOREHOLE_ID</OCQL>
                    </idExpression>
				</AttributeMapping>
				<AttributeMapping>
					<targetAttribute>sa:sampledFeature</targetAttribute>
					<ClientProperty>
						<name>xlink:href</name>
						<value>'http://resource.geoscience.gov.au/classifier/GA/earth/earth_crust'</value>
					</ClientProperty>
					<ClientProperty>
						<name>xlink:title</name>
						<value>'Earth crust'</value>
					</ClientProperty>
				</AttributeMapping>
				<AttributeMapping>
					<targetAttribute>sa:relatedSamplingFeature/sa:SamplingFeatureComplex/sa:role</targetAttribute>
					<ClientProperty>
						<name>xlink:href</name>
						<value>'http://resource.geoscience.gov.au/classifier/GA/samplingfeaturerole/borehole_specimen'</value>
					</ClientProperty>
					<ClientProperty>
						<name>xlink:title</name>
						<value>'borehole specimen'</value>
					</ClientProperty>
				</AttributeMapping>
				<AttributeMapping>
					<targetAttribute>sa:relatedSamplingFeature/sa:SamplingFeatureComplex/sa:relatedSamplingFeature</targetAttribute>
					<targetAttributeNode>spec:SF_SpecimenPropertyType</targetAttributeNode>
				</AttributeMapping>
				<AttributeMapping>
					<targetAttribute>sa:relatedSamplingFeature/sa:SamplingFeatureComplex/sa:relatedSamplingFeature/spec:SF_Specimen</targetAttribute>
					<idExpression><OCQL>strConcat('borehole.specimen.GA.', SAMPLE_ID)</OCQL></idExpression>
				</AttributeMapping>              
				<AttributeMapping>
					<targetAttribute>sa:relatedSamplingFeature/sa:SamplingFeatureComplex/sa:relatedSamplingFeature/spec:SF_Specimen/sa:sampledFeature</targetAttribute>
					<ClientProperty>
						<name>xlink:href</name>
						<value>strConcat('http://data.geoscience.gov.au/feature/GA/geologicunit/', STRATNO)</value>
					</ClientProperty>
					<ClientProperty>
						<name>xlink:title</name>
						<value>STRATNAME</value>
					</ClientProperty>
				</AttributeMapping>     
				<AttributeMapping>
					<targetAttribute>sa:relatedSamplingFeature/sa:SamplingFeatureComplex/sa:relatedSamplingFeature/spec:SF_Specimen/spec:materialClass</targetAttribute>
					<ClientProperty>
						<name>xlink:href</name>
						<value>'http://resource.geoscience.gov.au/classifier/GA/materialclass/rock'</value>
					</ClientProperty>
					<ClientProperty>
						<name>xlink:title</name>
						<value>'rock'</value>
					</ClientProperty>
				</AttributeMapping>                
				<!--AttributeMapping>
					<targetAttribute>sa:relatedSamplingFeature/sa:SamplingFeatureComplex/sa:relatedSamplingFeature/spec:SF_Specimen/spec:samplingTime/gml:TimeInstant</targetAttribute>
					<idExpression><OCQL>strConcat('borehole.specimen.samplingTime.GA.', SAMPLE_ID)</OCQL></idExpression>
				</AttributeMapping-->  
				<AttributeMapping>
					<targetAttribute>sa:relatedSamplingFeature/sa:SamplingFeatureComplex/sa:relatedSamplingFeature/spec:SF_Specimen/spec:samplingTime/gml:TimeInstant/gml:timePosition</targetAttribute>
					<sourceExpression><OCQL>SAMPLING_DATE</OCQL></sourceExpression>
				</AttributeMapping>     
				<AttributeMapping>
					<targetAttribute>sa:relatedSamplingFeature/sa:SamplingFeatureComplex/sa:relatedSamplingFeature/spec:SF_Specimen/spec:samplingLocation</targetAttribute>
					<idExpression><OCQL>strConcat('borehole.specimen.samplingLocation.GA.', SAMPLE_ID)</OCQL></idExpression>
					<sourceExpression><OCQL>ToLineString(strConcat('#borehole.shape.GA.', ID), INTERVAL_BEGIN, INTERVAL_END)</OCQL></sourceExpression>
					<ClientProperty>
						<name>uomLabels</name>
						<value>'m'</value>
					</ClientProperty>
				</AttributeMapping>   
				<AttributeMapping>
					<targetAttribute>sa:relatedSamplingFeature/sa:SamplingFeatureComplex/sa:relatedSamplingFeature/spec:SF_Specimen/spec:specimenType</targetAttribute>
					<ClientProperty>
					    <name>xlink:href</name>
					    <value>strConcat('http://resource.geoscience.gov.au/classifier/GA/specimentype/', SAMPLE_TYPE)</value>
					</ClientProperty>
					<ClientProperty>
					    <name>xlink:title</name>
					    <value>SAMPLE_TYPE</value>
					</ClientProperty>
				</AttributeMapping>
				<AttributeMapping>
				    <targetAttribute>sams:shape/gml:Curve</targetAttribute>			    
				    <idExpression><OCQL>strConcat('borehole.shape.GA.', ID)</OCQL></idExpression>	
				</AttributeMapping>
				<AttributeMapping>
				    <targetAttribute>gsmlbh:referenceLocation</targetAttribute>
				    <ClientProperty>
				        <name>nilReason</name>
				        <value>'missing'</value>
				    </ClientProperty>
				</AttributeMapping>
				<AttributeMapping>
				    <targetAttribute>gsmlbh:indexData</targetAttribute>
				    <ClientProperty>
				        <name>xsi:nil</name>
				        <value>'true'</value>
				    </ClientProperty>
				    <ClientProperty>
				        <name>nilReason</name>
				        <value>'missing'</value>
				    </ClientProperty>
				</AttributeMapping>
				<AttributeMapping>
				    <targetAttribute>gsmlbh:downholeDrillingDetails</targetAttribute>
				    <ClientProperty>
				        <name>xsi:nil</name>
				        <value>'true'</value>
				    </ClientProperty>
				    <ClientProperty>
				        <name>nilReason</name>
				        <value>'missing'</value>
				    </ClientProperty>
				</AttributeMapping>
				<AttributeMapping>
				    <targetAttribute>gsmlbh:logElement</targetAttribute>
				    <ClientProperty>
				        <name>xsi:nil</name>
				        <value>'true'</value>
				    </ClientProperty>
				    <ClientProperty>
				        <name>nilReason</name>
				        <value>'missing'</value>
				    </ClientProperty>
				</AttributeMapping>
			</attributeMappings>
		</FeatureTypeMapping>
	</typeMappings>
</as:AppSchemaDataAccess>